{layout name="layout2" /}
<style>
    .layui-form-item .layui-input-inline{
        margin-top:10px;
    }
    .layui-form-label {
        color: #6a6f6c;
        width: 100px;
        line-height: 15px;
    }
    #container {
        margin-left: 130px;
        width: 60%;
        height: 60%;
    }
    .layui-input-block {
        margin-left: 130px;
    }
    .tips{
        color: red;
    }
    .unit-tips{
        float: left;
        display: block;
        padding: 9px 0!important;
        line-height: 20px;
        margin-right: 10px;
    }
    .goods{
        display: none;
    }
    .layui-input-block{
        margin-bottom: 10px;
    }




</style>
<script charset="utf-8" src="https://map.qq.com/api/gljs?v=1.exp&libraries=service&key=E2WBZ-XPM3B-VTOUQ-NZQTD-KHBHT-ZYBVF"></script>
<div class="layui-form" lay-filter="layuiadmin-form-user" id="layuiadmin-form-user" style="padding: 20px 30px 0 0;">
    <div class="layui-form-item">
        <fieldset class="layui-elem-field layui-field-title">
            <legend>必填模块</legend>
        </fieldset>
        <label class="layui-form-label"><span class="tips">*</span>用户类型：</label>
        <div class="layui-input-block">
            <select name="type" class="layui-input">
            <option value="">请选择用户类型</option>
            <option value="1">商户</option>
            <option value="2">家庭用户</option>
            <option value="3">经销商</option>
            </select>
        </div>
        <label class="layui-form-label"><span class="tips">*</span>用气单位：</label>
        <div class="layui-input-block">
            <input type="text" name="name" lay-verify="required" lay-verType="tips" placeholder="用气单位/人名称" autocomplete="off" class="layui-input">
        </div>
        <label class="layui-form-label"><span class="tips">*</span>联系电话</label>
        <div class="layui-input-block">
            <input type="text" name="mobile" lay-verify="required" lay-verType="tips" placeholder="联系电话" autocomplete="off" class="layui-input">
        </div>
        <label id="panel" class="layui-form-label"><span class="tips">*</span>所在位置-省市区：</label>
        <div class="layui-input-block">
            <input id='address' name="address" type="text" value='' class="btn layui-input" placeholder="请输入省市区街道门牌号 然后点击转换坐标">
            <input id="convert" type="button" class="layui-btn layui-btn-xs" value="转换坐标" onclick="convert()" />
            <a href="https://lbs.qq.com/getPoint/" target="_blank" style="color:#01AAED"><i class="layui-icon layui-icon-link"></i>拾取坐标</a>
        </div>
        <label class="layui-form-label"><span class="tips">*</span>详细地址：</label>
        <div class="layui-input-block">
            <input type="text" id="address_detail" name="address_detail" lay-verify="required" lay-verType="tips" placeholder="详细地址-门牌号" autocomplete="off" class="layui-input">
        </div>
<!--        <label class="layui-form-label"><span class="tips">*</span>所在经度：</label>-->
<!--        <div class="layui-input-inline">-->
<!--            <input type="text" id="longitude" name="longitude" lay-verify="required" lay-verType="tips" placeholder="所在经度" autocomplete="off" class="layui-input">-->
<!--        </div>-->
        <label class="layui-form-label"><span class="tips">*</span>所在经纬度：</label>
        <div class="layui-input-block">
            <input type="text" id="latitude" name="latitude" lay-verify="required" lay-verType="tips" placeholder="所在纬度" autocomplete="off" class="layui-input">
        </div>
        <label class="layui-form-label"><span class="tips">*</span>所在楼层：</label>
        <div class="layui-input-block">
            <input type="text" name="floor" lay-verify="required" lay-verType="tips" placeholder="所在楼层" autocomplete="off" class="layui-input">
        </div>
        <label class="layui-form-label"><span class="tips">*</span>充装站：</label>
        <div class="layui-input-block">
            <select name="site_id" class="layui-input">
                <option value="">请选择充装站</option>
                {foreach $bottle_site_list as $val}
                <option value="{$val.id}">{$val.name}</option>
                {/foreach}
            </select>
        </div>
        <label class="layui-form-label"><span class="tips">*</span>是否有电梯：</label>
        <div class="layui-input-block">
            <input type="radio" name="if_elevator" value="1" title="是" checked>
            <input type="radio" name="if_elevator" value="0" title="否" >
        </div>
    </div>
    <div class="layui-form-item">
        <fieldset class="layui-elem-field layui-field-title">
            <legend>非必填模块</legend>
        </fieldset>
        <label class="layui-form-label">开户时间：</label>
        <div class="layui-input-block">
            <input type="text" name="reg_time" id="reg_time" lay-verify="" lay-verType="tips" placeholder="开户时间" autocomplete="off" class="layui-input">
        </div>
        <label class="layui-form-label">押瓶金额：</label>
        <div class="layui-input-block">
            <input type="text" name="bottle_deposit" lay-verify="" lay-verType="tips" placeholder="押瓶金额" autocomplete="off" class="layui-input">
        </div>
        <label class="layui-form-label">押瓶租金/月：</label>
        <div class="layui-input-block">
            <input type="text" name="bottle_rent" lay-verify="" lay-verType="tips" placeholder="押瓶租金/月" autocomplete="off" class="layui-input">
        </div>
        <label class="layui-form-label">账号状态：</label>
        <div class="layui-input-block">
            <input type="radio" name="status" value="1" title="正常" checked>
            <input type="radio" name="status" value="2" title="禁用" >
        </div>
        <label class="layui-form-label">最近一次下单时间：</label>
        <div class="layui-input-block">
            <input type="text" name="order_last_time" id="order_last_time" lay-verify="" lay-verType="tips" placeholder="最近一次下单时间" autocomplete="off" class="layui-input">
        </div>
        <label class="layui-form-label">优惠金额：</label>
        <div class="layui-input-block">
            <input type="text" name="discount_amount" lay-verify="" lay-verType="tips" placeholder="优惠金额" autocomplete="off" class="layui-input">
        </div>
        <label class="layui-form-label">是否有押瓶：</label>
        <div class="layui-input-block">
            <input type="text" name="if_bottle" lay-verify="" lay-verType="tips" placeholder="是否有押瓶" autocomplete="off" class="layui-input">
        </div>
        <label class="layui-form-label">我的押瓶数：</label>
        <div class="layui-input-block">
            <input type="text" name="bottle_num" lay-verify="" lay-verType="tips" placeholder="我的押瓶数" autocomplete="off" class="layui-input">
        </div>
        <label class="layui-form-label">注册时间：</label>
        <div class="layui-input-block">
            <input type="text" name="create_time" lay-verify="" lay-verType="tips" placeholder="注册时间" autocomplete="off" class="layui-input">
        </div>
<!--        <label class="layui-form-label"><span class="tips">*</span>是否删除：</label>-->
<!--        <div class="layui-input-inline">-->
<!--            <input type="radio" name="del" value="1" title="是" checked>-->
<!--            <input type="radio" name="del" value="0" title="否" >-->
<!--        </div>-->
<!--        <label class="layui-form-label">是否已下单：</label>-->
<!--        <div class="layui-input-inline">-->
<!--            <input type="radio" name="if_order" value="1" title="是" checked>-->
<!--            <input type="radio" name="if_order" value="0" title="否" >-->
<!--        </div>-->
    </div>
    <!--地图组件显示-->
    <div class="layui-form-item" id="container"></div>

    <div class="layui-form-item layui-hide">
        <input type="button" lay-submit lay-filter="add-user-submit" id="add-user-submit" value="确认">
    </div>
</div>
<script>
    layui.config({
        version:"{$front_version}",
        base: '/static/plug/layui-admin/dist/layuiadmin/' //静态资源所在路径
    }).extend({
        index: 'lib/index' //主入口模块
    }).use(['index', 'table','form','laydate'], function(){
        var $ = layui.$
            ,form = layui.form
            ,laydate = layui.laydate
            ,table = layui.table
        laydate.render({
            elem: '#reg_time'
            // ,format: 'yyyy-MM-dd H:i'
            ,type: 'datetime'
            ,trigger: 'click'
        });
        laydate.render({
            elem: '#order_last_time'
            // ,format: 'yyyy-MM-dd H:i'
            ,type: 'datetime'
            ,trigger: 'click'
        });
    });
var map = new TMap.Map('container', {
  zoom: 14,
  center: new TMap.LatLng(39.986785, 116.301012),
});
var geocoder = new TMap.service.Geocoder(); // 新建一个正逆地址解析类
var markers = new TMap.MultiMarker({
  map: map,
  geometries: [],
});


function convert() {
  markers.setGeometries([]);
  // 将给定的地址转换为坐标位置
  geocoder
    .getLocation({ address: document.getElementById('address').value })
    .then((result) => {
      markers.updateGeometries([
        {
          id: 'main',
          position: result.result.location, // 将得到的坐标位置用点标记标注在地图上
        },
      ]);
      map.setCenter(result.result.location);

      // document.getElementById(
      //   'longitude'
      // ).value = result.result.location;
      document.getElementById(
        'latitude'
      ).value = result.result.location;
      
      // 显示坐标数值
    });
}
</script>